package myicesscheduler.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

public class LoginCommandValidator implements Validator
{
   protected final Log logger = LogFactory.getLog( getClass() );

   @SuppressWarnings( "unchecked" )
   public boolean supports( Class clazz )
   {
      return LoginCommand.class.equals( clazz );
   }

   public void validate( Object arg0, Errors err )
   {
      final LoginCommand cmd = (LoginCommand) arg0;
      if( null == cmd )
      {
         err.reject( "Null command object" );
         return;
      }
      logger.info( cmd.toString() );

   }

}
